package com.servicea.controller;

import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author linlx
 * @Date 2021/8/14 14:35
 * @Description
 **/
@RestController
public class TestController {

  @Autowired
  private StringRedisTemplate stringRedisTemplate;


  @GetMapping("/testExpire")
  public void testExpire() {
    stringRedisTemplate.opsForHash().put("hashKey", "key", "value");
    stringRedisTemplate.expire("hashKey", 10, TimeUnit.SECONDS);
  }

}
